package com.smart.redisson.controller;

import com.smart.redisson.lock.DistributedLock;
import com.smart.redisson.lock.DistributedLockType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class TestController {
    @DistributedLock(value = "lock:test",
            waitTime = 180,
            leaseTime = 3)
    @GetMapping("/")
    public String test() {
        log.info("test--=--->");
        return "注解版分布式锁";
    }


    @DistributedLock(
            waitTime = 180,
            leaseTime = 3,
            type = DistributedLockType.RED_LOCK,
            multiNames = {"lock1", "lock2", "lock3"}
    )
    @GetMapping("/test")
    public String test1() {
        log.info("test--=--->");
        return "注解版分布式锁";
    }
}
